//
//  QuXuanTiCell.m
//  ZhiBoYuan
//
//  Created by apple on 2018/4/23.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "QuXuanTiCell.h"

@implementation QuXuanTiCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
//        [self addSubview:self]
    }
    return self;
}

-(void)setQuestiion:(Questiion *)questiion{
    _questiion = questiion;
    
    
    
    //    cell.tittleLabel.text = [Helper filterHTML:q.ques_stem_text];
    
//    self.numberLabel.text = [Helper filterHTML:questiion.analysis];
    //[NSString stringWithFormat:@"%zd",indexPath.row+1]
//    self.numberLabel.text = [Helper filterHTML:questiion.ques_stem_text];
    
    NSString *liongXing = [[NSString alloc]init];
    
    self.hardLabel.text = [NSString stringWithFormat:@"难度系数:%@",liongXing];
    
    NSString * iamgeStr=@"单";
    
    if ([questiion.ques_model integerValue]  == 2)
    {
        iamgeStr = @"问";
    }
    else if ([questiion.ques_model integerValue]  == 1)
    {
        iamgeStr = @"多副本";
    }else if ([questiion.ques_model integerValue]  == 0)
    {
        iamgeStr = @"单";
    }
    
    
    NSString *str = [NSString stringWithFormat:@" %@",[Helper filterHTML:questiion.ques_stem_text]];
    
    self.numberLabel.attributedText = [Helper attributedString:str imageName:iamgeStr imageFram:CGRectZero];
    
    
    
    NSMutableArray *nameArr =@[].mutableCopy;
    
    NSLog(@"%@",questiion.hard_level);
    
    for (int i = 0; i<5; i++) {
        if ( i >= [questiion.hard_level integerValue] )
        {
            [nameArr addObject:@"五角星-1副本5"]; // 黄星星
        }
        else
        {
            [nameArr addObject:@"五角星-1"];  // 灰色星星
        }
    }
    
    NSMutableArray* buttons = [NSMutableArray arrayWithCapacity:5];
    CGRect btnRect = CGRectMake(80, 0, 20, 20);
    
    for (NSString* optionTitle in nameArr)
    {
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:btnRect];
        btnRect.origin.x += 25;
        imageView.image = [UIImage imageNamed:optionTitle];
        [self.hardLabel addSubview:imageView];
        [buttons addObject:imageView];
    }
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
